package com.czbank.financing.mapper;

import com.czbank.financing.Entity.Account;
import com.czbank.financing.Entity.Product;

import org.apache.ibatis.annotations.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @Auther: thinkpad
 * @Date: 2019/7/13 01:07
 * @Description:
 */
@Resource(name="productMapper")
public interface ProductMapper {

    @Select("SELECT * FROM product where product_name = #{productName}")
    public Product findProductInfo(@Param("productName") String productName);

    @Select("SELECT * FROM product")
    public List<Product> TotalProduct();

    @Update("Update product set product_name = #{productName}," +
            "product_type = #{productType},product_price=#{productPrice}," +
            "product_limit=#{productLimit},product_profits=#{productProfits}," +
            "product_describe=#{productDescribe} where pid =#{pid}")
    public int UpdateProductInfo(Product product);

    @Delete("delete from product where product_name=#{productName}")
    public int DeleteProductInfo(@Param("productName") String productName);

    @Insert("insert into product (pid,product_name,product_type,product_price,product_limit,product_profits," +
            "product_describe,creationtime) values(#{pid},#{productName},#{productType},#{productPrice}," +
            "#{productLimit},#{productProfits},#{productDescribe},#{creationTime})")
    public int InsertProductInfo(Product product);

}
